package com.wangshuile.vue.service.impl;

import java.util.Optional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

import com.wangshuile.vue.entity.Article;
import com.wangshuile.vue.repository.ArticleRepository;
import com.wangshuile.vue.service.ArticleService;

@Service
public class ArticleServiceImpl implements ArticleService {
	
	@Autowired
	private ArticleRepository articleRepository;

	@Override
	public Article save(Article article) {
		return articleRepository.save(article);
	}

	@Override
	public void deleteById(String articleId) {
		articleRepository.deleteById(articleId);
	}

	@Override
	public Article saveAndFlush(Article article) {
		return articleRepository.saveAndFlush(article);
	}

	@Override
	public Optional<Article> findById(String articleId) {
		return articleRepository.findById(articleId);
	}

	@Override
	public Page<Article> findAll(PageRequest of) {
		return articleRepository.findAll(of);
	}

}
